<?php
include_once("admin_common.inc.php");
include_once( _INC_PATH."database.php" );

if(checkAdmin()){

	$db = new database();
	$sql = "SELECT COUNT(id) AS count FROM `tbl_estimate` WHERE DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(CURDATE() - INTERVAL 2 DAY, '%Y-%m-%d')";
	$qian_count = $db->loadResult($sql);
	$smarty->assign("qian_count",$qian_count);

	$sql = "SELECT COUNT(id) AS count FROM `tbl_estimate` WHERE DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(CURDATE() - INTERVAL 1 DAY, '%Y-%m-%d')";
	$zuo_count = $db->loadResult($sql);
	$smarty->assign("zuo_count",$zuo_count);

	$sql = "SELECT COUNT(id) AS count FROM `tbl_estimate` WHERE DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(CURDATE(), '%Y-%m-%d')";
	$jin_count = $db->loadResult($sql);
	$smarty->assign("jin_count",$jin_count);

	adminDisplay("admin_index.tpl");
}else{
	$smarty->display("management/admin_login.tpl");
}

?>